package cn.dgut.training.service.impl;

import cn.dgut.training.entity.user.Balance;
import cn.dgut.training.mapper.BalanceMapper;
import cn.dgut.training.service.IBalanceService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.math.BigDecimal;

@Service
public class BalanceServiceImpl extends ServiceImpl<BalanceMapper, Balance> implements IBalanceService {

    @Resource
    private BalanceMapper balanceMapper;

    @Override
    public void createBalance(Long userId) {
        Balance balance=new Balance();
        balance.setUserId(userId);
        balance.setMoney(new BigDecimal(0.00));
        balanceMapper.insert(balance);
    }
}
